/**
 * spring board url列表. 
 */
var urlList = (function(){  
    
    return Observable.create({
        init : function(){
            this.cardList = new CardList($('#urlList'), CardListView.urlCardTmp);
            this.cardList.$itemAdder.attr('title', lan('app.im.link.share'));
            this.cardList.$itemAdder.click(function(){
                ujs.ui.Dialog.get(ShareURLDialog , {
                    title : lan('app.im.link.share'),
                    relType : 'web'
                });
            });
            this.cardList.$itemAdder.tooltipster({
                theme : 'tooltipster-light',                
                offsetY : -70
            });            
            //删除link
            this.cardList.on('deleteItem', function(cardID){
                var _this = this;        
                bubble.confirm(lan('app.im.link.delTip'), function(){
                    page.biz.deleteLink(cardID, function(msg){
                        _this.deleteItem(cardID);    
                    }); 
                });
            });
            //编辑link
            this.cardList.on('editItem', function(cardID){ 
                var obj = page.urlStore.getItem(cardID);                
                ujs.ui.Dialog.get(ShareURLDialog, {       
                    title : lan('app.im.link.edit'),             
                    mode : 'edit',
                    relType : 'web',
                    ueid : cardID                        
                });
            });
            this.cardList.on('cardIconClick', function(cardID){
                var obj = page.urlStore.getItem(cardID);
                window.open(obj.url);
                return false;
            });            
        }
    });
})();